package 模式匹配;

public class InstanceofPatternMatching {
    public static void main(String[] args) {
        Object obj = "Hello, world!";
        
        if (obj instanceof String str) {
            System.out.println(str.length()); // 输出: 13
        }
    }
}
